<%= render :partial => 'edit_channel_header' -%>

<%- form_for_channel do |f| -%>
  <%= f.error_messages -%>
  <%= f.hidden_field :direction, :value => Channel::Bidirectional -%>
  <%= render :partial => 'edit_name', :locals => {:f => f} -%>
  <%= render :partial => 'edit_protocol', :locals => {:f => f, :default => 'xmpp'} -%>
  <%= render :partial => 'edit_priority', :locals => {:f => f} -%>
  <%= render :partial => 'edit_application', :locals => {:f => f} -%>
  <%- f.fields_for :configuration do |c| -%>
    <p>
    <%= c.label :user -%><br/>
    <%= c.text_field :user, :value => @channel[:configuration][:user] -%>
    </p>
    <p>
    <%= c.label :domain -%><br/>
    <%= c.text_field :domain, :value => @channel[:configuration][:domain] -%>
    </p>
    <p>
    <%= c.label :password -%><br/>
    <%= c.password_field :password, :value => @channel[:configuration][:password] -%>
    </p>
    <p>
    <%= c.label :server -%><br/>
    <%= c.text_field :server, :value => @channel[:configuration][:server] -%>
    </p>
    <p>
    <%= c.label :port -%><br/>
    <%= c.text_field :port, :value => @channel[:configuration][:port] || 5222 -%>
    </p>
    <p>
    <%= c.label :resource -%><br/>
    <%= c.text_field :resource, :value => @channel[:configuration][:resource] -%>
    </p>
    <p>
    <%= c.label :status -%><br/>
    <%= c.text_field :status, :value => @channel[:configuration][:status] -%>
    </p>
  <%- end -%>
  <%= render :partial => 'edit_costs', :locals => {:f => f} -%>
  <%= render :partial => 'shared/edit_custom_attributes', :locals => {:f => f, :entity => @channel, :as_restriction => true} -%>
  <%= render :partial => 'edit_ao_rules', :locals => {:f => f} -%>
  <%= render :partial => 'edit_at_rules', :locals => {:f => f} -%>
  <%= channel_submit_tag -%>
<%- end -%>

<%= link_to 'Go back', :controller => :home, :action => :channels -%>
